(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 11.1' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       158,          7]
NotebookDataLength[     69105,       1765]
NotebookOptionsPosition[     65134,       1672]
NotebookOutlinePosition[     65497,       1688]
CellTagsIndexPosition[     65454,       1685]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell["\<\
*****************************************************************************
*   Notebook written by: Fabian St\[ODoubleDot]ckl      \t\t                  *
*   E-Mail: fstoeckl@diw.de                                                   \
   * 
*****************************************************************************
******************************************************************************\
******************************************************************************\
**********************
*    This notebook uses the Package \"MaTeX\[CloseCurlyDoubleQuote] written \
by Szabolcs Horv\[AAcute]t \
(http://szhorvat.net/pelican/latex-typesetting-in-mathematica.html)    *
******************************************************************************\
******************************************************************************\
**********************\
\>", "Text",
 CellChangeTimes->{{3.803296525642475*^9, 3.803296606317089*^9}, {
  3.8033017724235735`*^9, 3.8033017865893836`*^9}, {3.803312053691663*^9, 
  3.8033122329989185`*^9}, {3.803373517173113*^9, 3.803373523704122*^9}, {
  3.8033736760553365`*^9, 3.8033737270724077`*^9}, {3.8407254480099325`*^9, 
  3.840725451615196*^9}},ExpressionUUID->"0f9a4e7b-4739-48d6-acc7-\
ac10de2846d3"],

Cell[BoxData[
 RowBox[{"ClearAll", "[", "\"\<Global`*\>\"", "]"}]], "Input",
 CellChangeTimes->{{3.799308452704911*^9, 3.7993084534999566`*^9}, {
  3.8033765432943935`*^9, 
  3.803376565867425*^9}},ExpressionUUID->"9337ec9f-666f-4e0c-9b50-\
d9e3fbb4f3a4"],

Cell[BoxData[{
 RowBox[{
  RowBox[{"<<", "MaTeX`"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"SetOptions", "[", 
   RowBox[{"MaTeX", ",", 
    RowBox[{"\"\<Preamble\>\"", "\[Rule]", 
     RowBox[{"{", "}"}]}], ",", "\n", 
    RowBox[{"\"\<BasePreamble\>\"", "\[Rule]", 
     RowBox[{"{", 
      RowBox[{
      "\"\<\\\\usepackage{lmodern,exscale}\>\"", ",", 
       "\"\<\\\\usepackage{amsmath,amssymb,xcolor,eurosym}\>\""}], "}"}]}], 
    ",", 
    RowBox[{"\"\<Preamble\>\"", "\[Rule]", 
     RowBox[{"{", "}"}]}], ",", 
    RowBox[{"\"\<DisplayStyle\>\"", "\[Rule]", "True"}], ",", 
    RowBox[{"ContentPadding", "\[Rule]", "True"}], ",", 
    RowBox[{"LineSpacing", "\[Rule]", 
     RowBox[{"{", 
      RowBox[{"1.2`", ",", "0"}], "}"}]}], ",", 
    RowBox[{"FontSize", "\[Rule]", "10"}], ",", 
    RowBox[{"Magnification", "\[Rule]", "1"}], ",", 
    RowBox[{"\"\<LogFileFunction\>\"", "\[Rule]", "None"}], ",", 
    RowBox[{"\"\<TeXFileFunction\>\"", "\[Rule]", "None"}]}], "]"}], 
  ";"}]}], "Input",
 CellChangeTimes->{{3.800946890258362*^9, 
  3.800946893530549*^9}},ExpressionUUID->"2fa4f08f-c495-42f1-9f0b-\
6392399f926e"],

Cell[" ", "Text",
 Editable->False,
 Selectable->False,
 CellFrame->{{0, 0}, {0, 3}},
 ShowCellBracket->False,
 CellMargins->{{0, 0}, {1, 1}},
 CellElementSpacings->{"CellMinHeight"->1},
 CellFrameMargins->0,
 CellFrameColor->RGBColor[0, 0, 1],
 CellSize->{
  Inherited, 5},ExpressionUUID->"da3ad750-d73c-40b5-9ed5-a2ca3e5ce6b9"],

Cell[CellGroupData[{

Cell["Data Import +++ requires user input +++", "Section",
 CellChangeTimes->{{3.792503789244561*^9, 3.7925038045594373`*^9}, 
   3.8033738424065704`*^9},ExpressionUUID->"b5d0c6b6-dacb-4cb0-91f1-\
3d6e1731915f"],

Cell[TextData[{
 StyleBox["\[OpenCurlyDoubleQuote]work_book\[CloseCurlyDoubleQuote]", "Code"],
 " is the name of the workbook, i.e., the scenario, used for the fitting \
process;",
 StyleBox[" Range[#,#]", "Code"],
 " defines clean-shares to be included in the fitting process; data input for \
the CES and VES parameters can be copied from \
\[OpenCurlyDoubleQuote]fitting.nb\[CloseCurlyDoubleQuote]"
}], "Text",
 CellChangeTimes->{{3.8032969318467083`*^9, 3.803297081902291*^9}, {
  3.8032971382075114`*^9, 3.803297205459358*^9}, {3.803373876326623*^9, 
  3.803373899030655*^9}},ExpressionUUID->"aa0640f8-0669-4dca-b909-\
fc26633ac5de"],

Cell[BoxData[
 RowBox[{
  RowBox[{"(*", " ", 
   RowBox[{"Data", " ", "of", " ", "the", " ", "baseline", " ", "scenario"}], 
   " ", "*)"}], "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{
    RowBox[{"importeddata", "=", 
     RowBox[{"Import", "[", 
      RowBox[{"\"\<C:\\\\Users\\\\...\\\\data-input-file.xlsx\>\"", ",", 
       RowBox[{"{", 
        RowBox[{"\"\<Data\>\"", ",", "\"\<on_off_pv_bat_phs_p2g\>\"", ",", 
         RowBox[{"Range", "[", 
          RowBox[{"14", ",", "109"}], "]"}], ",", 
         RowBox[{"{", 
          RowBox[{"143", ",", "142", ",", "140"}], "}"}]}], "}"}]}], "]"}]}], 
    ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", 
   RowBox[{"(*", " ", 
    RowBox[{
     RowBox[{
     "Data", " ", "of", " ", "the", " ", "scenario", " ", "to", " ", "which", 
      " ", "the", " ", "CES", " ", "should", " ", "be", " ", "re"}], "-", 
     "fitted"}], " ", "*)"}], "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"importeddatanew", "=", 
     RowBox[{"Import", "[", 
      RowBox[{"\"\<C:\\\\Users\\\\...\\\\data-input-file.xlsx\>\"", ",", 
       RowBox[{"{", 
        RowBox[{"\"\<Data\>\"", ",", "\"\<on_off_bat_phs_p2g\>\"", ",", 
         RowBox[{"Range", "[", 
          RowBox[{"14", ",", "109"}], "]"}], ",", 
         RowBox[{"{", 
          RowBox[{"143", ",", "142"}], "}"}]}], "}"}]}], "]"}]}], ";"}], 
   "\[IndentingNewLine]", "\[IndentingNewLine]", 
   RowBox[{"(*", " ", 
    RowBox[{
    "Values", " ", "of", " ", "the", " ", "baseline", " ", "scenario"}], " ", 
    "*)"}], "\n", 
   RowBox[{
    RowBox[{"cesfitold", "=", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"\[Alpha]", "\[Rule]", "0.41427377218240474`"}], ",", 
       RowBox[{"\[Rho]", "\[Rule]", "0.8451397225510672`"}], ",", 
       RowBox[{"cestfp", "\[Rule]", "0.029599827936869216`"}]}], "}"}]}], 
    ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", 
   RowBox[{"(*", " ", 
    RowBox[{
     RowBox[{
     "Values", " ", "of", " ", "the", " ", "scenario", " ", "to", " ", 
      "which", " ", "the", " ", "CES", " ", "should", " ", "be", " ", "re"}], 
     "-", "fitted"}], " ", "*)"}], "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"cesfitnew", "=", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"\[Alpha]", "\[Rule]", "0.3737982760950977`"}], ",", 
       RowBox[{"\[Rho]", "\[Rule]", "0.8160775456089803`"}], ",", 
       RowBox[{"cestfp", "\[Rule]", "0.02787425060963684`"}]}], "}"}]}], 
    ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"dirty", "=", 
     RowBox[{"importeddata", "[", 
      RowBox[{"[", 
       RowBox[{"All", ",", "1"}], "]"}], "]"}]}], ";"}], 
   "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"clean", "=", 
     RowBox[{"importeddata", "[", 
      RowBox[{"[", 
       RowBox[{"All", ",", "2"}], "]"}], "]"}]}], ";"}], 
   "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"dirtynew", "=", 
     RowBox[{"importeddatanew", "[", 
      RowBox[{"[", 
       RowBox[{"All", ",", "1"}], "]"}], "]"}]}], ";"}], 
   "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"cleannew", "=", 
     RowBox[{"importeddatanew", "[", 
      RowBox[{"[", 
       RowBox[{"All", ",", "2"}], "]"}], "]"}]}], ";"}], 
   "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"production", "=", 
     RowBox[{"importeddata", "[", 
      RowBox[{"[", 
       RowBox[{"All", ",", "3"}], "]"}], "]"}]}], ";"}], 
   "\[IndentingNewLine]", "\[IndentingNewLine]", 
   RowBox[{"(*", " ", 
    RowBox[{
     RowBox[{"Initial", " ", "Normalization", " ", "Point"}], " ", "-", " ", 
     RowBox[{"here", ":", " ", 
      RowBox[{
      "as", " ", "for", " ", "the", " ", "implicitly", " ", "normalized", " ",
        "CES", " ", "function", " ", "as", " ", "presented", " ", "in", " ", 
       "the", " ", "Paper"}]}]}], " ", "*)"}], "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"cnold", "=", "1"}], ";"}], "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"dnold", "=", "1"}], ";"}], "\[IndentingNewLine]", 
   "\[IndentingNewLine]", 
   RowBox[{"(*", " ", 
    RowBox[{
     RowBox[{
      RowBox[{"New", " ", "Normalization", " ", "Point"}], " ", "-", " ", 
      RowBox[{"here", ":", " ", 
       RowBox[{
       "for", " ", "a", " ", "clean", " ", "share", " ", "of", " ", "c"}]}]}],
      "=", 
     RowBox[{"0.01", "%"}]}], " ", "*)"}], "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"cnnew", "=", 
     RowBox[{"Min", "[", "clean", "]"}]}], ";"}], "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"dnnew", "=", 
     RowBox[{"Max", "[", "dirty", "]"}]}], ";"}], "\[IndentingNewLine]", 
   "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"alphaold", "=", 
     RowBox[{
      RowBox[{"cesfitold", "[", 
       RowBox[{"[", "1", "]"}], "]"}], "[", 
      RowBox[{"[", "2", "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"rhoold", "=", 
     RowBox[{
      RowBox[{"cesfitold", "[", 
       RowBox[{"[", "2", "]"}], "]"}], "[", 
      RowBox[{"[", "2", "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"cestfpold", "=", 
     RowBox[{
      RowBox[{"cesfitold", "[", 
       RowBox[{"[", "3", "]"}], "]"}], "[", 
      RowBox[{"[", "2", "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", 
   "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"out", "=", 
     RowBox[{"cestfpold", 
      RowBox[{
       RowBox[{"(", 
        RowBox[{
         RowBox[{"\[Alpha]", " ", 
          RowBox[{
           RowBox[{"(", 
            RowBox[{"c", "/", "cn"}], ")"}], "^", "\[Rho]"}]}], " ", "+", " ", 
         RowBox[{
          RowBox[{"(", 
           RowBox[{"1", "-", "\[Alpha]"}], ")"}], " ", 
          RowBox[{
           RowBox[{"(", 
            RowBox[{"d", "/", "dn"}], ")"}], "^", "\[Rho]"}]}]}], ")"}], "^", 
       RowBox[{"(", 
        RowBox[{"1", "/", "\[Rho]"}], ")"}]}]}]}], ";"}], 
   "\[IndentingNewLine]", "\[IndentingNewLine]", 
   RowBox[{
    RowBox[{"mrts", "=", 
     RowBox[{
      RowBox[{"D", "[", 
       RowBox[{"out", ",", "c"}], "]"}], "/", 
      RowBox[{"D", "[", 
       RowBox[{"out", ",", "d"}], "]"}]}]}], ";"}]}]}]], "Input",
 CellChangeTimes->{{3.7913955853782463`*^9, 3.7913956097836423`*^9}, {
   3.7913958914557533`*^9, 3.7913958965750456`*^9}, {3.7913960059112997`*^9, 
   3.791396018436016*^9}, {3.7913962059307404`*^9, 3.7913962122190995`*^9}, {
   3.7913963056634445`*^9, 3.791396323684475*^9}, {3.7913963986127605`*^9, 
   3.79139640506813*^9}, {3.7913964780903063`*^9, 3.7913965094731016`*^9}, {
   3.791396689718411*^9, 3.7913966969248233`*^9}, {3.791396803290907*^9, 
   3.7913968345276937`*^9}, {3.791396876822113*^9, 3.7913969186995077`*^9}, {
   3.791397210078174*^9, 3.7913972478053317`*^9}, {3.7913973648560266`*^9, 
   3.791397371998435*^9}, {3.791397416157961*^9, 3.7913974163269706`*^9}, {
   3.791397514466584*^9, 3.7913975202889166`*^9}, {3.791397779075719*^9, 
   3.791397792856507*^9}, {3.79139788277065*^9, 3.791397909579183*^9}, {
   3.7913992351730027`*^9, 3.7913992394542475`*^9}, {3.791399273101172*^9, 
   3.791399298786641*^9}, 3.791399369544688*^9, {3.7914000886278176`*^9, 
   3.791400091233967*^9}, {3.7914001233158016`*^9, 3.7914001236338196`*^9}, 
   3.7914001641941395`*^9, 3.791400299580883*^9, {3.791400367637776*^9, 
   3.791400383316673*^9}, {3.7927571035949087`*^9, 3.79275711701725*^9}, 
   3.793120379977236*^9, {3.7931204440449*^9, 3.7931204475861025`*^9}, {
   3.7931205349320984`*^9, 3.793120547865838*^9}, {3.7939840547402077`*^9, 
   3.793984061960621*^9}, {3.793984120675979*^9, 3.793984131196581*^9}, 
   3.796027455722553*^9, {3.796544683127831*^9, 3.7965447007138367`*^9}, {
   3.7965447399740825`*^9, 3.796544748740584*^9}, {3.796583562553772*^9, 
   3.796583589319303*^9}, {3.796583982367784*^9, 3.7965839827408056`*^9}, 
   3.797340957301244*^9, 3.797340999824676*^9, {3.797437319425536*^9, 
   3.7974373445329723`*^9}, {3.7974376539096675`*^9, 3.797437654284689*^9}, {
   3.79760242107596*^9, 3.7976024216089907`*^9}, 3.798657727954669*^9, 
   3.798657922423792*^9, {3.799402455928365*^9, 3.799402460665636*^9}, {
   3.7997408175168595`*^9, 3.7997408187289286`*^9}, {3.799762196157648*^9, 
   3.799762198064757*^9}, {3.800356473645932*^9, 3.800356473740937*^9}, {
   3.8003566766055403`*^9, 3.8003566773725843`*^9}, {3.8003567742611265`*^9, 
   3.800356774689151*^9}, {3.8033766657715707`*^9, 3.8033767978427663`*^9}, {
   3.8033768295288115`*^9, 3.80337691394993*^9}, {3.8033769528469896`*^9, 
   3.8033769631510143`*^9}, {3.8033775611398697`*^9, 
   3.8033776082899466`*^9}, {3.8033842899618015`*^9, 
   3.803384294571808*^9}},ExpressionUUID->"f248115f-2759-47e1-90d4-\
f25bc85b661e"],

Cell[" ", "Text",
 Editable->False,
 Selectable->False,
 CellFrame->{{0, 0}, {0, 3}},
 ShowCellBracket->False,
 CellMargins->{{0, 0}, {1, 1}},
 CellElementSpacings->{"CellMinHeight"->1},
 CellFrameMargins->0,
 CellFrameColor->RGBColor[0, 0, 1],
 CellSize->{
  Inherited, 5},ExpressionUUID->"a50e10ac-208b-4c82-a5d2-2055663b7c4f"]
}, Open  ]],

Cell[CellGroupData[{

Cell["Calculation of the new normalization point", "Section",
 CellChangeTimes->{{3.792503789244561*^9, 3.7925038045594373`*^9}, 
   3.8033738424065704`*^9, {3.8033769932460566`*^9, 3.803376995036059*^9}, {
   3.803377069443164*^9, 
   3.8033770799891787`*^9}},ExpressionUUID->"d68f80a8-30b1-4c0f-a946-\
2f96968a9e14"],

Cell[BoxData[
 RowBox[{"mrtsinnewNP", "=", 
  RowBox[{"mrts", "/.", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"\[Rho]", "\[Rule]", "rhoold"}], ",", 
     RowBox[{"c", "\[Rule]", "cnnew"}], ",", 
     RowBox[{"d", "\[Rule]", "dnnew"}], ",", 
     RowBox[{"cn", "\[Rule]", "cnold"}], ",", 
     RowBox[{"dn", "\[Rule]", "dnold"}], ",", 
     RowBox[{"\[Alpha]", "\[Rule]", "alphaold"}]}], "}"}]}]}]], "Input",
 CellChangeTimes->{{3.7990570633112054`*^9, 3.7990570925408773`*^9}, {
  3.799058179308037*^9, 3.799058196661029*^9}, {3.799058272768382*^9, 
  3.7990582740994587`*^9}, {3.799058350966855*^9, 3.799058408980173*^9}, {
  3.799238602113884*^9, 3.799238626710291*^9}, {3.7992386600061955`*^9, 
  3.7992387040797167`*^9}, {3.7992387512694154`*^9, 3.799238753830562*^9}, {
  3.7992388069025974`*^9, 3.7992388071426115`*^9}, {3.799239731093458*^9, 
  3.7992397608331594`*^9}, {3.79923998515199*^9, 3.799239987379117*^9}, {
  3.7992400206090174`*^9, 3.7992400220831017`*^9}, {3.79924037574833*^9, 
  3.799240393178327*^9}, {3.7992410909672384`*^9, 3.799241091766284*^9}, {
  3.7992411646074505`*^9, 3.7992411742930045`*^9}, {3.7993075680583124`*^9, 
  3.7993075716525183`*^9}, {3.79930765071804*^9, 
  3.799307653841219*^9}},ExpressionUUID->"b13bf1d7-c53a-4922-a908-\
f4a1c08f25ec"],

Cell[BoxData[
 RowBox[{
  RowBox[{"(*", " ", 
   RowBox[{
   "In", " ", "the", " ", "normalization", " ", "point", " ", "the", " ", 
    "following", " ", "always", " ", 
    RowBox[{"holds", ":"}]}], " ", "*)"}], "\[IndentingNewLine]", 
  RowBox[{"(*", " ", 
   RowBox[{
    RowBox[{
     RowBox[{
      FractionBox[
       RowBox[{
        SuperscriptBox[
         RowBox[{"(", 
          FractionBox["c", "cn"], ")"}], 
         RowBox[{
          RowBox[{"-", "1"}], "+", "\[Rho]"}]], " ", 
        SuperscriptBox[
         RowBox[{"(", 
          FractionBox["d", "dn"], ")"}], 
         RowBox[{"1", "-", "\[Rho]"}]], " ", "dn", " ", "\[Alpha]"}], 
       RowBox[{"cn", " ", 
        RowBox[{"(", 
         RowBox[{"1", "-", "\[Alpha]"}], ")"}]}]], " ", "--"}], "\[Rule]", 
     " ", 
     FractionBox[
      RowBox[{"dn", " ", "\[Alpha]"}], 
      RowBox[{"cn", " ", 
       RowBox[{"(", 
        RowBox[{"1", "-", "\[Alpha]"}], ")"}]}]]}], "=", "mrts"}], " ", 
   "*)"}]}]], "Input",
 CellChangeTimes->{{3.7992417713361535`*^9, 3.799241786102998*^9}, {
  3.799241928305132*^9, 3.79924192863215*^9}, {3.8033770013580675`*^9, 
  3.8033770132190847`*^9}},ExpressionUUID->"f57a3856-54b9-4be0-b25a-\
2fe06611af5c"],

Cell[BoxData[
 RowBox[{"alphaover1minusalpha", "=", 
  RowBox[{"mrtsinnewNP", "*", 
   RowBox[{"cnnew", "/", "dnnew"}]}]}]], "Input",
 CellChangeTimes->{{3.7992418517847548`*^9, 3.7992418643124714`*^9}, {
  3.799241912531229*^9, 3.7992419453651075`*^9}, {3.799242007456659*^9, 
  3.7992420121719284`*^9}},ExpressionUUID->"9bf3c367-26f5-4c0b-a9a6-\
9c14fc00c4d9"],

Cell[BoxData[
 RowBox[{"newalpha", "=", 
  RowBox[{"alphaover1minusalpha", "/", 
   RowBox[{"(", 
    RowBox[{"1", "+", "alphaover1minusalpha"}], ")"}]}]}]], "Input",
 CellChangeTimes->{{3.7992390036128488`*^9, 3.799239013108392*^9}, {
  3.7992399325259795`*^9, 3.7992399344540896`*^9}, {3.7992415493034534`*^9, 
  3.7992415507665377`*^9}, {3.7992418763491597`*^9, 
  3.79924187862029*^9}},ExpressionUUID->"6e7e4e46-de1c-4bfc-bbc1-\
cda0b388f42d"],

Cell[BoxData[
 RowBox[{
  RowBox[{"(*", " ", 
   RowBox[{"internal", ":", " ", 
    RowBox[{
    "alternative", " ", "method", " ", "via", " ", "the", " ", "income", " ", 
     "share"}]}], " ", "*)"}], 
  RowBox[{"mrts", "=", 
   RowBox[{
    RowBox[{
     RowBox[{"(", 
      RowBox[{
       RowBox[{"D", "[", 
        RowBox[{"out", ",", "c"}], "]"}], " ", "c"}], ")"}], "/", 
     RowBox[{"(", 
      RowBox[{
       RowBox[{
        RowBox[{"D", "[", 
         RowBox[{"out", ",", "d"}], "]"}], "d"}], "+", 
       RowBox[{
        RowBox[{"D", "[", 
         RowBox[{"out", ",", "c"}], "]"}], " ", "c"}]}], ")"}]}], "/.", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"\[Rho]", "\[Rule]", "rhoold"}], ",", 
      RowBox[{"c", "\[Rule]", "cnnew"}], ",", 
      RowBox[{"d", "\[Rule]", "dnnew"}], ",", 
      RowBox[{"cn", "\[Rule]", "cnold"}], ",", 
      RowBox[{"dn", "\[Rule]", "dnold"}], ",", 
      RowBox[{"\[Alpha]", "\[Rule]", "alphaold"}]}], "}"}], 
    " "}]}]}]], "Input",
 CellChangeTimes->{{3.7992433868775573`*^9, 3.7992434738795333`*^9}, {
  3.7992435139378242`*^9, 3.7992435245014286`*^9}, {3.79930767921467*^9, 
  3.7993076795676904`*^9}, {3.7993077679367447`*^9, 3.799307788693932*^9}, {
  3.7993129673931365`*^9, 3.799312973440482*^9}, {3.8033770260551023`*^9, 
  3.803377039301121*^9}},ExpressionUUID->"00c35f79-3923-469b-b5d3-\
fbcc762467f2"],

Cell[" ", "Text",
 Editable->False,
 Selectable->False,
 CellFrame->{{0, 0}, {0, 3}},
 ShowCellBracket->False,
 CellMargins->{{0, 0}, {1, 1}},
 CellElementSpacings->{"CellMinHeight"->1},
 CellFrameMargins->0,
 CellFrameColor->RGBColor[0, 0, 1],
 CellSize->{
  Inherited, 5},ExpressionUUID->"c1f9996a-3218-4066-963d-18bcaf05a538"],

Cell[BoxData[
 RowBox[{"prod", "=", 
  RowBox[{
   RowBox[{"cestfpold", 
    RowBox[{
     RowBox[{"(", 
      RowBox[{
       RowBox[{"\[Alpha]", " ", 
        RowBox[{
         RowBox[{"(", 
          RowBox[{"c", "/", "cn"}], ")"}], "^", "\[Rho]"}]}], " ", "+", " ", 
       RowBox[{
        RowBox[{"(", 
         RowBox[{"1", "-", "\[Alpha]"}], ")"}], " ", 
        RowBox[{
         RowBox[{"(", 
          RowBox[{"d", "/", "dn"}], ")"}], "^", "\[Rho]"}]}]}], ")"}], "^", 
     RowBox[{"(", 
      RowBox[{"1", "/", "\[Rho]"}], ")"}]}]}], "/.", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"\[Rho]", "\[Rule]", "rhoold"}], ",", 
     RowBox[{"c", "\[Rule]", "cnnew"}], ",", 
     RowBox[{"d", "\[Rule]", "dnnew"}], ",", 
     RowBox[{"cn", "\[Rule]", "cnold"}], ",", 
     RowBox[{"dn", "\[Rule]", "dnold"}], ",", 
     RowBox[{"\[Alpha]", "\[Rule]", "alphaold"}]}], "}"}]}]}]], "Input",
 CellChangeTimes->{{3.79139792666216*^9, 3.791397936960749*^9}, {
   3.79139806075683*^9, 3.7913981062414317`*^9}, {3.7913981720571957`*^9, 
   3.791398183342841*^9}, {3.791398299323475*^9, 3.791398309245043*^9}, {
   3.791399204041222*^9, 3.7913992073454113`*^9}, {3.791399256587228*^9, 
   3.791399258050311*^9}, {3.791399333194609*^9, 3.791399360536173*^9}, {
   3.7913999348940244`*^9, 3.7913999737622476`*^9}, {3.7914000751250453`*^9, 
   3.791400085536641*^9}, {3.79734346245053*^9, 3.797343467748833*^9}, {
   3.797343499734663*^9, 3.7973435120373664`*^9}, {3.799239846080035*^9, 
   3.7992398493782234`*^9}, 3.799239880407998*^9, {3.7992399127868505`*^9, 
   3.7992399163660555`*^9}, {3.799240241960678*^9, 3.7992402424187045`*^9}, {
   3.7992403436124926`*^9, 3.7992403436974974`*^9}, 3.7992416424717827`*^9, {
   3.799244323149109*^9, 3.7992443340147305`*^9}, {3.7993078385287824`*^9, 
   3.7993078616101027`*^9}},ExpressionUUID->"2c703373-1d9a-4288-8327-\
9eaa55b6b9c9"],

Cell[BoxData[
 RowBox[{"cestfpnew", "=", 
  RowBox[{
   RowBox[{"prod", "/", 
    RowBox[{"(", 
     RowBox[{
      RowBox[{"(", 
       RowBox[{
        RowBox[{"\[Alpha]", " ", 
         RowBox[{
          RowBox[{"(", 
           RowBox[{"c", "/", "cn"}], ")"}], "^", "\[Rho]"}]}], " ", "+", " ", 
        RowBox[{
         RowBox[{"(", 
          RowBox[{"1", "-", "\[Alpha]"}], ")"}], " ", 
         RowBox[{
          RowBox[{"(", 
           RowBox[{"d", "/", "dn"}], ")"}], "^", "\[Rho]"}]}]}], ")"}], "^", 
      RowBox[{"(", 
       RowBox[{"1", "/", "\[Rho]"}], ")"}]}], ")"}]}], "/.", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"\[Alpha]", "\[Rule]", "newalpha"}], ",", 
     RowBox[{"\[Rho]", "\[Rule]", "rhoold"}], ",", 
     RowBox[{"cn", "\[Rule]", "cnnew"}], ",", 
     RowBox[{"dn", "\[Rule]", "dnnew"}], ",", 
     RowBox[{"c", "\[Rule]", "cnnew"}], ",", 
     RowBox[{"d", "\[Rule]", "dnnew"}]}], "}"}]}]}]], "Input",
 CellChangeTimes->{{3.7992445128369584`*^9, 3.7992445869341965`*^9}, {
  3.7993078120232663`*^9, 
  3.7993078134563484`*^9}},ExpressionUUID->"b5a9d245-4585-4949-a50f-\
2ac58829c9c2"],

Cell[" ", "Text",
 Editable->False,
 Selectable->False,
 CellFrame->{{0, 0}, {0, 3}},
 ShowCellBracket->False,
 CellMargins->{{0, 0}, {1, 1}},
 CellElementSpacings->{"CellMinHeight"->1},
 CellFrameMargins->0,
 CellFrameColor->RGBColor[0, 0, 1],
 CellSize->{
  Inherited, 5},ExpressionUUID->"3cc0991e-9b52-412e-9e20-c23576351179"]
}, Open  ]],

Cell[CellGroupData[{

Cell["\<\
Comparison of the Production Isoquants with the Old and New Normalization \
Point\
\>", "Section",
 CellChangeTimes->{{3.792503789244561*^9, 3.7925038045594373`*^9}, 
   3.8033738424065704`*^9, {3.8033769932460566`*^9, 3.803376995036059*^9}, {
   3.803377069443164*^9, 3.8033770799891787`*^9}, {3.803377423182676*^9, 
   3.8033774585467253`*^9}},ExpressionUUID->"bdef7f3d-710f-46fe-a093-\
bc3df86ace7c"],

Cell[BoxData[
 RowBox[{"p1", "=", 
  RowBox[{"Plot", "[", 
   RowBox[{
    RowBox[{
     RowBox[{"(", 
      RowBox[{
       RowBox[{"(", 
        RowBox[{
         RowBox[{"(", 
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{"(", 
              RowBox[{
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"production", "[", 
                  RowBox[{"[", "1", "]"}], "]"}], "/", "cestfpold"}], ")"}], 
               "^", "\[Rho]"}], ")"}], "-", 
             RowBox[{"(", 
              RowBox[{
               RowBox[{"(", 
                RowBox[{"1", "-", "\[Alpha]"}], ")"}], " ", 
               RowBox[{
                RowBox[{"(", 
                 RowBox[{"d", "/", "dn"}], ")"}], "^", "\[Rho]"}]}], ")"}]}], 
            ")"}], "/", "\[Alpha]"}], ")"}], "^", 
         RowBox[{"(", 
          RowBox[{"1", "/", "\[Rho]"}], ")"}]}], ")"}], "*", "cn"}], ")"}], "/.", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"\[Alpha]", "\[Rule]", "alphaold"}], ",", 
       RowBox[{"\[Rho]", "\[Rule]", "rhoold"}], ",", 
       RowBox[{"cn", "\[Rule]", "cnold"}], ",", 
       RowBox[{"dn", "\[Rule]", "dnold"}]}], "}"}]}], ",", 
    RowBox[{"{", 
     RowBox[{"d", ",", 
      RowBox[{"Min", "[", "dirty", "]"}], ",", 
      RowBox[{"Max", "[", "dirty", "]"}]}], "}"}], ",", 
    RowBox[{"PlotStyle", "\[Rule]", "Green"}], ",", 
    RowBox[{"PlotRange", "\[Rule]", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
         RowBox[{"Min", "[", "dirty", "]"}], ",", 
         RowBox[{"Max", "[", "dirty", "]"}]}], "}"}], ",", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"Min", "[", "clean", "]"}], ",", 
         RowBox[{"Max", "[", "clean", "]"}]}], "}"}]}], "}"}]}]}], 
   "]"}]}]], "Input",
 CellChangeTimes->{{3.799239210185664*^9, 3.7992392142268953`*^9}, {
   3.799239824521802*^9, 3.7992398661121807`*^9}, {3.7992400398751197`*^9, 
   3.7992401073459787`*^9}, {3.799240331217783*^9, 3.799240332331847*^9}, 
   3.7992416454899554`*^9, {3.7992422579569864`*^9, 3.7992422760660224`*^9}, {
   3.799242314278208*^9, 3.799242333917331*^9}, 3.7992436548898864`*^9, 
   3.7992438772976074`*^9, {3.7992439230582247`*^9, 3.7992439237152624`*^9}, {
   3.7992443728059487`*^9, 3.799244374410041*^9}, {3.799307875537899*^9, 
   3.799307891000784*^9}, {3.799308505778947*^9, 3.799308552237604*^9}, {
   3.7993086296950345`*^9, 3.799308641048684*^9}, {3.799769111533185*^9, 
   3.7997691162014513`*^9}},ExpressionUUID->"11bb7634-251a-4643-9b49-\
9c12e31d07e9"],

Cell[BoxData[
 RowBox[{"p2", "=", 
  RowBox[{"Plot", "[", 
   RowBox[{
    RowBox[{
     RowBox[{"(", 
      RowBox[{
       RowBox[{"(", 
        RowBox[{
         RowBox[{"(", 
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{"(", 
              RowBox[{
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"production", "[", 
                  RowBox[{"[", "1", "]"}], "]"}], "/", "cestfpnew"}], ")"}], 
               "^", "\[Rho]"}], ")"}], "-", 
             RowBox[{"(", 
              RowBox[{
               RowBox[{"(", 
                RowBox[{"1", "-", "\[Alpha]"}], ")"}], " ", 
               RowBox[{
                RowBox[{"(", 
                 RowBox[{"d", "/", "dn"}], ")"}], "^", "\[Rho]"}]}], ")"}]}], 
            ")"}], "/", "\[Alpha]"}], ")"}], "^", 
         RowBox[{"(", 
          RowBox[{"1", "/", "\[Rho]"}], ")"}]}], ")"}], "*", "cn"}], ")"}], "/.", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"\[Alpha]", "\[Rule]", "newalpha"}], ",", 
       RowBox[{"\[Rho]", "\[Rule]", "rhoold"}], ",", 
       RowBox[{"cn", "\[Rule]", "cnnew"}], ",", 
       RowBox[{"dn", "\[Rule]", "dnnew"}]}], "}"}]}], ",", 
    RowBox[{"{", 
     RowBox[{"d", ",", 
      RowBox[{"Min", "[", "dirty", "]"}], ",", 
      RowBox[{"Max", "[", "dirty", "]"}]}], "}"}], ",", 
    RowBox[{"PlotStyle", "\[Rule]", 
     RowBox[{"Directive", "[", 
      RowBox[{"Blue", ",", "Dashed"}], "]"}]}], ",", 
    RowBox[{"PlotRange", "\[Rule]", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
         RowBox[{"Min", "[", "dirty", "]"}], ",", 
         RowBox[{"Max", "[", "dirty", "]"}]}], "}"}], ",", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"Min", "[", "clean", "]"}], ",", 
         RowBox[{"Max", "[", "clean", "]"}]}], "}"}]}], "}"}]}]}], 
   "]"}]}]], "Input",
 CellChangeTimes->{{3.799239281303732*^9, 3.7992393153376784`*^9}, 
   3.7992393835995827`*^9, {3.799239440013809*^9, 3.799239449513353*^9}, {
   3.799239671385043*^9, 3.7992396782894382`*^9}, {3.7992399537901955`*^9, 
   3.799239960384573*^9}, {3.799240154768691*^9, 3.799240213817068*^9}, {
   3.7992402666550903`*^9, 3.7992403018711047`*^9}, {3.799240334567975*^9, 
   3.799240335460026*^9}, 3.7992416503772345`*^9, {3.7992422637973204`*^9, 
   3.7992423364904785`*^9}, {3.799242412624833*^9, 3.799242423922479*^9}, {
   3.799242548862625*^9, 3.7992425802294197`*^9}, {3.7992427383704643`*^9, 
   3.7992427513172054`*^9}, {3.7992427850511346`*^9, 3.799242788662341*^9}, {
   3.7992428708580427`*^9, 3.7992428746872616`*^9}, {3.799243656941004*^9, 
   3.799243710748081*^9}, 3.7992438825809097`*^9, {3.799243934241864*^9, 
   3.799243934990907*^9}, {3.799243997347474*^9, 3.799244036825732*^9}, {
   3.7992441875103507`*^9, 3.7992442173160553`*^9}, {3.799244377744231*^9, 
   3.79924439188304*^9}, {3.799244493831871*^9, 3.799244493938877*^9}, {
   3.79926261018258*^9, 3.799262619648122*^9}, {3.799307896870119*^9, 
   3.799307901570388*^9}, {3.7993086601537766`*^9, 3.799308674692608*^9}, {
   3.799769119351632*^9, 
   3.7997691243099155`*^9}},ExpressionUUID->"e5531ccd-0b0b-4966-99ee-\
3e4df930864d"],

Cell[BoxData[
 RowBox[{"Show", "[", 
  RowBox[{"p1", ",", "p2"}], "]"}]], "Input",
 CellChangeTimes->{{3.799243937330041*^9, 3.799243941364272*^9}, {
  3.7992626378121605`*^9, 
  3.799262643256472*^9}},ExpressionUUID->"85bdd43c-fa13-4898-9349-\
fbad05ce991d"],

Cell[" ", "Text",
 Editable->False,
 Selectable->False,
 CellFrame->{{0, 0}, {0, 3}},
 ShowCellBracket->False,
 CellMargins->{{0, 0}, {1, 1}},
 CellElementSpacings->{"CellMinHeight"->1},
 CellFrameMargins->0,
 CellFrameColor->RGBColor[0, 0, 1],
 CellSize->{
  Inherited, 5},ExpressionUUID->"d18c15e7-10c4-4be8-aaef-01265b83fb16"]
}, Open  ]],

Cell[CellGroupData[{

Cell["Re-Fitting", "Section",
 CellChangeTimes->{{3.792503789244561*^9, 3.7925038045594373`*^9}, 
   3.8033738424065704`*^9, {3.8033769932460566`*^9, 3.803376995036059*^9}, {
   3.803377069443164*^9, 3.8033770799891787`*^9}, {3.803377423182676*^9, 
   3.8033774585467253`*^9}, {3.803377644838998*^9, 
   3.8033776483340025`*^9}},ExpressionUUID->"2b659fd2-558a-44f4-9a3d-\
2513b65db51c"],

Cell[BoxData[
 RowBox[{
  RowBox[{"MSEold", "=", 
   RowBox[{
    RowBox[{"Total", "[", 
     RowBox[{
      RowBox[{"(", 
       RowBox[{
        RowBox[{"(", 
         RowBox[{
          RowBox[{"Evaluate", "[", 
           RowBox[{
            RowBox[{"cestfp", "*", 
             RowBox[{"(", 
              RowBox[{
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"\[Alpha]", " ", 
                  RowBox[{"x", "^", "\[Rho]"}]}], " ", "+", " ", 
                 RowBox[{
                  RowBox[{"(", 
                   RowBox[{"1", "-", "\[Alpha]"}], ")"}], " ", 
                  RowBox[{"y", "^", "\[Rho]"}]}]}], ")"}], "^", 
               RowBox[{"(", 
                RowBox[{"1", "/", "\[Rho]"}], ")"}]}], ")"}]}], "/.", 
            "cesfitold"}], "]"}], "/.", 
          RowBox[{"{", 
           RowBox[{
            RowBox[{"x", "\[Rule]", "clean"}], ",", 
            RowBox[{"y", "\[Rule]", "dirty"}]}], "}"}]}], ")"}], "-", 
        "production"}], ")"}], "^", "2"}], "]"}], "/", 
    RowBox[{"Length", "[", "clean", "]"}]}]}], ";"}]], "Input",
 CellChangeTimes->{{3.799327870796562*^9, 3.7993278853433943`*^9}, {
  3.799327949149044*^9, 3.799327956542467*^9}, {3.79932801814199*^9, 
  3.7993280793604918`*^9}, {3.799328124546076*^9, 3.7993281402669754`*^9}, {
  3.8033777027430797`*^9, 3.803377704868082*^9}, {3.8033777404541326`*^9, 
  3.803377745020139*^9}, {3.803378937514843*^9, 3.8033789427998505`*^9}, {
  3.8033790153449526`*^9, 
  3.8033790171449547`*^9}},ExpressionUUID->"ff75bb7c-e0f1-480f-b5b8-\
e5dcdf6512bf"],

Cell[BoxData[
 RowBox[{
  RowBox[{"MSEtobefitted", "=", 
   RowBox[{
    RowBox[{"Total", "[", 
     RowBox[{
      RowBox[{"(", 
       RowBox[{
        RowBox[{"(", 
         RowBox[{
          RowBox[{"Evaluate", "[", 
           RowBox[{
            RowBox[{"cestfp", "*", 
             RowBox[{"(", 
              RowBox[{
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"\[Alpha]", " ", 
                  RowBox[{"x", "^", "\[Rho]"}]}], " ", "+", " ", 
                 RowBox[{
                  RowBox[{"(", 
                   RowBox[{"1", "-", "\[Alpha]"}], ")"}], " ", 
                  RowBox[{"y", "^", "\[Rho]"}]}]}], ")"}], "^", 
               RowBox[{"(", 
                RowBox[{"1", "/", "\[Rho]"}], ")"}]}], ")"}]}], "/.", 
            "cesfitnew"}], "]"}], "/.", 
          RowBox[{"{", 
           RowBox[{
            RowBox[{"x", "\[Rule]", "cleannew"}], ",", 
            RowBox[{"y", "\[Rule]", "dirtynew"}]}], "}"}]}], ")"}], "-", 
        "production"}], ")"}], "^", "2"}], "]"}], "/", 
    RowBox[{"Length", "[", "clean", "]"}]}]}], ";"}]], "Input",
 CellChangeTimes->{{3.803378948880859*^9, 3.803378950450861*^9}, {
  3.8033790232609634`*^9, 3.803379025035966*^9}, {3.8033790892940564`*^9, 
  3.8033790922790604`*^9}, {3.803379142574131*^9, 
  3.8033791556961527`*^9}},ExpressionUUID->"d3a54fda-cf70-40f7-a7cb-\
7ae8e0f9fc96"],

Cell[BoxData[
 RowBox[{
  RowBox[{"MSErenorm", "=", 
   RowBox[{
    RowBox[{"Total", "[", 
     RowBox[{
      RowBox[{"(", 
       RowBox[{
        RowBox[{"(", 
         RowBox[{
          RowBox[{"Evaluate", "[", 
           RowBox[{
            RowBox[{"cestfp", "*", 
             RowBox[{"(", 
              RowBox[{
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"\[Alpha]", " ", 
                  RowBox[{
                   RowBox[{"(", 
                    RowBox[{"x", "/", "cnnew"}], ")"}], "^", "\[Rho]"}]}], 
                 " ", "+", " ", 
                 RowBox[{
                  RowBox[{"(", 
                   RowBox[{"1", "-", "\[Alpha]"}], ")"}], " ", 
                  RowBox[{
                   RowBox[{"(", 
                    RowBox[{"y", "/", "dnnew"}], ")"}], "^", "\[Rho]"}]}]}], 
                ")"}], "^", 
               RowBox[{"(", 
                RowBox[{"1", "/", "\[Rho]"}], ")"}]}], ")"}]}], "/.", 
            RowBox[{"{", 
             RowBox[{
              RowBox[{"\[Alpha]", "\[Rule]", "newalpha"}], ",", 
              RowBox[{"\[Rho]", "\[Rule]", "rhoold"}], ",", 
              RowBox[{"cestfp", "\[Rule]", "cestfpnew"}]}], "}"}]}], "]"}], "/.", 
          RowBox[{"{", 
           RowBox[{
            RowBox[{"x", "\[Rule]", "clean"}], ",", 
            RowBox[{"y", "\[Rule]", "dirty"}]}], "}"}]}], ")"}], "-", 
        "production"}], ")"}], "^", "2"}], "]"}], "/", 
    RowBox[{"Length", "[", "clean", "]"}]}]}], ";"}]], "Input",
 CellChangeTimes->{{3.7993281475463915`*^9, 3.79932817793613*^9}, {
  3.7993282570226536`*^9, 3.799328272957565*^9}, {3.8033777478551435`*^9, 
  3.803377758628163*^9}},ExpressionUUID->"bfc9845b-3d37-444f-b175-\
716c9e5f0159"],

Cell[BoxData[
 RowBox[{
  RowBox[{"tobemin", "=", 
   RowBox[{
    RowBox[{"Total", "[", 
     RowBox[{
      RowBox[{"(", 
       RowBox[{
        RowBox[{"(", 
         RowBox[{
          RowBox[{"Evaluate", "[", 
           RowBox[{
            RowBox[{"cestfp", "*", 
             RowBox[{"(", 
              RowBox[{
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"\[Alpha]", " ", 
                  RowBox[{
                   RowBox[{"(", 
                    RowBox[{"x", "/", "cnnew"}], ")"}], "^", "\[Rho]"}]}], 
                 " ", "+", " ", 
                 RowBox[{
                  RowBox[{"(", 
                   RowBox[{"1", "-", "\[Alpha]"}], ")"}], " ", 
                  RowBox[{
                   RowBox[{"(", 
                    RowBox[{"y", "/", "dnnew"}], ")"}], "^", "\[Rho]"}]}]}], 
                ")"}], "^", 
               RowBox[{"(", 
                RowBox[{"1", "/", "\[Rho]"}], ")"}]}], ")"}]}], "/.", 
            RowBox[{"{", 
             RowBox[{
              RowBox[{"\[Alpha]", "\[Rule]", "newalpha"}], ",", 
              RowBox[{"cestfp", "\[Rule]", "cestfpnew"}]}], "}"}]}], "]"}], "/.", 
          RowBox[{"{", 
           RowBox[{
            RowBox[{"x", "\[Rule]", "cleannew"}], ",", 
            RowBox[{"y", "\[Rule]", "dirtynew"}]}], "}"}]}], ")"}], "-", 
        "production"}], ")"}], "^", "2"}], "]"}], "/", 
    RowBox[{"Length", "[", "clean", "]"}]}]}], ";"}]], "Input",
 CellChangeTimes->{{3.7993281475463915`*^9, 3.79932817793613*^9}, {
   3.7993282570226536`*^9, 3.7993283464267673`*^9}, {3.7993283970286613`*^9, 
   3.7993284108344507`*^9}, {3.799328444159357*^9, 3.7993284456704435`*^9}, 
   3.8033778089382334`*^9},ExpressionUUID->"e7b786bd-1fd8-4847-ab04-\
a09dae5c9f70"],

Cell[BoxData[
 RowBox[{
  RowBox[{"rhoreopt", "=", 
   RowBox[{
    RowBox[{
     RowBox[{
      RowBox[{"NMinimize", "[", 
       RowBox[{
        RowBox[{"{", 
         RowBox[{"tobemin", ",", 
          RowBox[{"\[Rho]", "\[LessEqual]", "1"}]}], "}"}], ",", "\[Rho]"}], 
       "]"}], "[", 
      RowBox[{"[", "2", "]"}], "]"}], "[", 
     RowBox[{"[", "1", "]"}], "]"}], "[", 
    RowBox[{"[", "2", "]"}], "]"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.7993283687060413`*^9, 3.799328371350192*^9}, {
   3.7993284135916085`*^9, 3.799328417215816*^9}, {3.7993284520778103`*^9, 
   3.799328482115528*^9}, 3.7997408595572643`*^9, {3.7997408907210464`*^9, 
   3.799740893790222*^9}, {3.7997628469938736`*^9, 3.799762863495817*^9}, 
   3.8033780916646376`*^9},ExpressionUUID->"d6c76658-8f74-4cd6-a99f-\
d96c5d03e82d"],

Cell[BoxData[
 RowBox[{
  RowBox[{"MSEnew", "=", 
   RowBox[{"tobemin", "/.", 
    RowBox[{"\[Rho]", "\[Rule]", "rhoreopt"}]}]}], ";"}]], "Input",
 CellChangeTimes->{{3.799328484863685*^9, 3.799328513224307*^9}, {
  3.799740896251363*^9, 3.799740898882513*^9}, {3.803377857095301*^9, 
  3.8033778608953066`*^9}, {3.8033780850736284`*^9, 
  3.8033780886286335`*^9}},ExpressionUUID->"5cc5b3cf-c7aa-4bd6-bfb3-\
4b68e00578c9"],

Cell[BoxData[
 RowBox[{
  RowBox[{"(*", " ", 
   RowBox[{
    RowBox[{
    "Comparison", " ", "of", " ", "scenario", " ", "to", " ", "be", " ", 
     "fitted", " ", "and", " ", "the", " ", "production", " ", "isoquant", 
     " ", "based", " ", "on", " ", "the", " ", "baseline", " ", "scenario", 
     " ", "with", " ", "re"}], "-", 
    RowBox[{
    "optimized", " ", "elasticity", " ", "of", " ", "substitution"}]}], " ", 
   "*)"}], "\[IndentingNewLine]", 
  RowBox[{"Plot", "[", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{
      RowBox[{
       RowBox[{"(", 
        RowBox[{
         RowBox[{"(", 
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{"(", 
              RowBox[{
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"(", 
                  RowBox[{
                   RowBox[{"production", "[", 
                    RowBox[{"[", "1", "]"}], "]"}], "/", "cestfpnew"}], ")"}],
                  "^", "\[Rho]"}], ")"}], "-", 
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"(", 
                  RowBox[{"1", "-", "\[Alpha]"}], ")"}], " ", 
                 RowBox[{
                  RowBox[{"(", 
                   RowBox[{"d", "/", "dn"}], ")"}], "^", "\[Rho]"}]}], 
                ")"}]}], ")"}], "/", "\[Alpha]"}], ")"}], "^", 
           RowBox[{"(", 
            RowBox[{"1", "/", "\[Rho]"}], ")"}]}], ")"}], "*", "cn"}], ")"}], 
       "/.", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"\[Alpha]", "\[Rule]", "newalpha"}], ",", 
         RowBox[{"\[Rho]", "\[Rule]", "rhoreopt"}], ",", 
         RowBox[{"cn", "\[Rule]", "cnnew"}], ",", 
         RowBox[{"dn", "\[Rule]", "dnnew"}]}], "}"}]}], ",", 
      RowBox[{
       RowBox[{"(", 
        RowBox[{
         RowBox[{"(", 
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"production", "[", 
                 RowBox[{"[", "1", "]"}], "]"}], "/", "cestfp"}], ")"}], "^", 
              "\[Rho]"}], " ", "-", " ", 
             RowBox[{
              RowBox[{"(", 
               RowBox[{"1", "-", "\[Alpha]"}], ")"}], " ", 
              RowBox[{"d", "^", "\[Rho]"}]}]}], ")"}], "/", "\[Alpha]"}], 
          ")"}], "^", 
         RowBox[{"(", 
          RowBox[{"1", "/", "\[Rho]"}], ")"}]}], ")"}], "/.", "cesfitnew"}]}],
      "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"d", ",", 
      RowBox[{"Min", "[", "dirty", "]"}], ",", 
      RowBox[{"Max", "[", "dirty", "]"}]}], "}"}], ",", 
    RowBox[{"PlotStyle", "\[Rule]", 
     RowBox[{"{", 
      RowBox[{"Green", ",", 
       RowBox[{"Directive", "[", 
        RowBox[{"Blue", ",", "Dashed"}], "]"}]}], "}"}]}], ",", 
    RowBox[{"PlotRange", "\[Rule]", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
         RowBox[{"0.8", "*", 
          RowBox[{"Min", "[", "dirty", "]"}]}], ",", 
         RowBox[{"1.2", 
          RowBox[{"Max", "[", "dirty", "]"}]}]}], "}"}], ",", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"Min", "[", "clean", "]"}], ",", 
         RowBox[{"Max", "[", "clean", "]"}]}], "}"}]}], "}"}]}]}], 
   "]"}]}]], "Input",
 CellChangeTimes->{{3.7997708787102613`*^9, 3.799770887335755*^9}, {
  3.803378127428693*^9, 
  3.8033781825377703`*^9}},ExpressionUUID->"734071b0-1869-4ef2-9e71-\
a9b81c208668"],

Cell[" ", "Text",
 Editable->False,
 Selectable->False,
 CellFrame->{{0, 0}, {0, 2}},
 ShowCellBracket->False,
 CellMargins->{{0, 0}, {1, 1}},
 CellElementSpacings->{"CellMinHeight"->1},
 CellFrameMargins->0,
 CellFrameColor->RGBColor[0, 0, 1],
 CellSize->{
  Inherited, 4},ExpressionUUID->"0bcc29a2-301e-4b42-adf8-64cde3347e59"]
}, Open  ]],

Cell[CellGroupData[{

Cell["Plot", "Section",
 CellChangeTimes->{{3.792503789244561*^9, 3.7925038045594373`*^9}, 
   3.8033738424065704`*^9, {3.8033769932460566`*^9, 3.803376995036059*^9}, {
   3.803377069443164*^9, 3.8033770799891787`*^9}, {3.803377423182676*^9, 
   3.8033774585467253`*^9}, {3.803377947008433*^9, 
   3.803377947528434*^9}},ExpressionUUID->"b8b9c42e-97c2-4887-96b8-\
d56aae72352e"],

Cell[BoxData[{
 RowBox[{
  RowBox[{"cm", "=", 
   RowBox[{"72", "/", "2.54"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"ipad", "=", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{"16", ",", "5"}], "}"}], ",", 
     RowBox[{"{", 
      RowBox[{"16", ",", "5"}], "}"}]}], "}"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"imargins", "=", "0"}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"isize", "=", 
   RowBox[{"6.45", "cm"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"isizebroad", "=", 
    RowBox[{"14", "cm"}]}], ";"}], 
  "\[IndentingNewLine]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"dirty", "=", 
   RowBox[{
    RowBox[{"importeddata", "[", 
     RowBox[{"[", 
      RowBox[{"All", ",", "1"}], "]"}], "]"}], "/", 
    RowBox[{"(", 
     RowBox[{"10", "^", "9"}], ")"}]}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"clean", "=", 
   RowBox[{
    RowBox[{"importeddata", "[", 
     RowBox[{"[", 
      RowBox[{"All", ",", "2"}], "]"}], "]"}], "/", 
    RowBox[{"(", 
     RowBox[{"10", "^", "9"}], ")"}]}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"production", "=", 
    RowBox[{"importeddata", "[", 
     RowBox[{"[", 
      RowBox[{"All", ",", "3"}], "]"}], "]"}]}], ";"}], 
  "\[IndentingNewLine]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"dirtynew", "=", 
   RowBox[{
    RowBox[{"importeddatanew", "[", 
     RowBox[{"[", 
      RowBox[{"All", ",", "1"}], "]"}], "]"}], "/", 
    RowBox[{"(", 
     RowBox[{"10", "^", "9"}], ")"}]}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"cleannew", "=", 
    RowBox[{
     RowBox[{"importeddatanew", "[", 
      RowBox[{"[", 
       RowBox[{"All", ",", "2"}], "]"}], "]"}], "/", 
     RowBox[{"(", 
      RowBox[{"10", "^", "9"}], ")"}]}]}], ";"}], 
  "\[IndentingNewLine]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"originaldataforplot", "=", 
   RowBox[{"Transpose", "@", 
    RowBox[{"{", 
     RowBox[{"dirty", ",", "clean"}], "}"}]}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"originaldataforplotnew", "=", 
    RowBox[{"Transpose", "@", 
     RowBox[{"{", 
      RowBox[{"dirtynew", ",", "cleannew"}], "}"}]}]}], ";"}], 
  "\[IndentingNewLine]"}], "\n", 
 RowBox[{
  RowBox[{
   RowBox[{"originaldataplot", "=", 
    RowBox[{"ListPlot", "[", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{"originaldataforplotnew", ",", "originaldataforplot"}], "}"}], 
      ",", 
      RowBox[{"FrameStyle", "\[Rule]", 
       RowBox[{"Directive", "[", 
        RowBox[{"Black", ",", "9"}], "]"}]}], ",", 
      RowBox[{"AspectRatio", "\[Rule]", "1"}], ",", 
      RowBox[{"PlotRange", "\[Rule]", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{"0", ",", "31"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"0", ",", "53"}], "}"}]}], "}"}]}], ",", 
      RowBox[{"PlotStyle", "\[Rule]", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"Directive", "[", 
          RowBox[{
           RowBox[{"GrayLevel", "[", "0.5", "]"}], ",", 
           RowBox[{"PointSize", "[", "0.02", "]"}]}], "]"}], ",", 
         RowBox[{"Directive", "[", 
          RowBox[{"Black", ",", 
           RowBox[{"PointSize", "[", "0.02", "]"}]}], "]"}]}], "}"}]}], ",", 
      RowBox[{"Frame", "\[Rule]", "True"}], ",", 
      RowBox[{"ImagePadding", "\[Rule]", "ipad"}], ",", 
      RowBox[{"ImageSize", "\[Rule]", "isize"}], ",", 
      RowBox[{"ImageMargins", "\[Rule]", "imargins"}], ",", 
      RowBox[{"PlotLegends", "\[Rule]", 
       RowBox[{"Placed", "[", 
        RowBox[{
         RowBox[{"PointLegend", "[", 
          RowBox[{
           RowBox[{"{", 
            RowBox[{
             RowBox[{"Directive", "[", 
              RowBox[{"Black", ",", 
               RowBox[{"PointSize", "[", "0.017", "]"}]}], "]"}], ",", 
             RowBox[{"Directive", "[", 
              RowBox[{
               RowBox[{"GrayLevel", "[", "0.5", "]"}], ",", 
               RowBox[{"PointSize", "[", "0.017", "]"}]}], "]"}]}], "}"}], 
           ",", 
           RowBox[{"{", 
            RowBox[{
             RowBox[{"Style", "[", 
              RowBox[{"\"\< All\>\"", ",", 
               RowBox[{"FontSize", "\[Rule]", "10"}], ",", "Italic", ",", 
               RowBox[{"FontFamily", "\[Rule]", "\"\<Times New Roman\>\""}]}],
               "]"}], ",", 
             RowBox[{"Style", "[", 
              RowBox[{"\"\< Wind only\>\"", ",", 
               RowBox[{"FontSize", "\[Rule]", "10"}], ",", "Italic", ",", 
               RowBox[{"FontFamily", "\[Rule]", "\"\<Times New Roman\>\""}]}],
               "]"}]}], "}"}], ",", 
           RowBox[{"Spacings", "\[Rule]", "0.3"}]}], "]"}], ",", 
         RowBox[{"{", 
          RowBox[{"0.675", ",", "0.9"}], "}"}]}], "]"}]}]}], "]"}]}], ";"}], 
  "\[IndentingNewLine]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"cesfittedplotfull", "=", 
    RowBox[{"Plot", "[", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"(", 
         RowBox[{"1", "/", 
          RowBox[{"(", 
           RowBox[{"10", "^", "9"}], ")"}]}], ")"}], "*", 
        RowBox[{"(", 
         RowBox[{
          RowBox[{"(", 
           RowBox[{
            RowBox[{"(", 
             RowBox[{
              RowBox[{
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"production", "[", 
                  RowBox[{"[", "1", "]"}], "]"}], "/", "cestfp"}], ")"}], "^",
                "\[Rho]"}], " ", "-", " ", 
              RowBox[{
               RowBox[{"(", 
                RowBox[{"1", "-", "\[Alpha]"}], ")"}], " ", 
               RowBox[{
                RowBox[{"(", 
                 RowBox[{"x", "*", 
                  RowBox[{"(", 
                   RowBox[{"10", "^", "9"}], ")"}]}], ")"}], "^", 
                "\[Rho]"}]}]}], ")"}], "/", "\[Alpha]"}], ")"}], "^", 
          RowBox[{"(", 
           RowBox[{"1", "/", "\[Rho]"}], ")"}]}], ")"}]}], "/.", 
       "cesfitold"}], ",", 
      RowBox[{"{", 
       RowBox[{"x", ",", 
        RowBox[{"0.75", "*", 
         RowBox[{"Min", "[", "dirty", "]"}]}], ",", 
        RowBox[{"Max", "[", "dirty", "]"}]}], "}"}], ",", 
      RowBox[{"PlotStyle", "\[Rule]", 
       RowBox[{"Directive", "[", 
        RowBox[{"Black", ",", 
         RowBox[{"Thickness", "[", "0.01", "]"}]}], "]"}]}], ",", 
      RowBox[{"PlotLegends", "\[Rule]", 
       RowBox[{"Placed", "[", 
        RowBox[{
         RowBox[{"LineLegend", "[", 
          RowBox[{
           RowBox[{"{", 
            RowBox[{
             RowBox[{"Directive", "[", 
              RowBox[{"Black", ",", 
               RowBox[{"Thickness", "[", "0.01", "]"}]}], "]"}], ",", 
             RowBox[{"Directive", "[", 
              RowBox[{
               RowBox[{"GrayLevel", "[", "0.5", "]"}], ",", 
               RowBox[{"Thickness", "[", "0.01", "]"}]}], "]"}], ",", 
             RowBox[{"Directive", "[", 
              RowBox[{
               RowBox[{"GrayLevel", "[", "0.85", "]"}], ",", "Dashed", ",", 
               RowBox[{"Thickness", "[", "0.01", "]"}]}], "]"}], ",", 
             RowBox[{"Directive", "[", "White", "]"}]}], "}"}], ",", 
           RowBox[{"{", 
            RowBox[{
             RowBox[{"Row", "[", 
              RowBox[{"{", 
               RowBox[{
                RowBox[{"Style", "[", 
                 RowBox[{"\"\<fit -\>\"", ",", 
                  RowBox[{"FontSize", "\[Rule]", "10"}]}], "]"}], ",", 
                RowBox[{"Style", "[", 
                 RowBox[{"\"\< All\>\"", ",", 
                  RowBox[{"FontSize", "\[Rule]", "10"}], ",", 
                  RowBox[{
                  "FontFamily", "\[Rule]", "\"\<Times New Roman\>\""}], ",", 
                  "Italic"}], "]"}]}], "}"}], "]"}], ",", 
             RowBox[{"Row", "[", 
              RowBox[{"{", 
               RowBox[{
                RowBox[{"Style", "[", 
                 RowBox[{"\"\<fit -\>\"", ",", 
                  RowBox[{"FontSize", "\[Rule]", "10"}]}], "]"}], ",", 
                RowBox[{"Style", "[", 
                 RowBox[{"\"\< Wind only\>\"", ",", 
                  RowBox[{"FontSize", "\[Rule]", "10"}], ",", 
                  RowBox[{
                  "FontFamily", "\[Rule]", "\"\<Times New Roman\>\""}], ",", 
                  "Italic"}], "]"}]}], "}"}], "]"}], ",", 
             RowBox[{"Row", "[", 
              RowBox[{"{", 
               RowBox[{
                RowBox[{"Style", "[", 
                 RowBox[{"\"\<fit -\>\"", ",", 
                  RowBox[{"FontSize", "\[Rule]", "10"}]}], "]"}], ",", 
                RowBox[{"Style", "[", 
                 RowBox[{"\"\< All \>\"", ",", 
                  RowBox[{"FontSize", "\[Rule]", "10"}], ",", 
                  RowBox[{
                  "FontFamily", "\[Rule]", "\"\<Times New Roman\>\""}], ",", 
                  "Italic"}], "]"}]}], "}"}], "]"}], ",", 
             RowBox[{"Style", "[", 
              RowBox[{"\"\<(\[Sigma] reopt.)\>\"", ",", 
               RowBox[{"FontSize", "\[Rule]", "8"}]}], "]"}]}], "}"}], ",", 
           RowBox[{"LegendMarkerSize", "\[Rule]", 
            RowBox[{"{", 
             RowBox[{"15", ",", "2"}], "}"}]}], ",", 
           RowBox[{"Spacings", "\[Rule]", "0.3"}]}], "]"}], ",", 
         RowBox[{"{", 
          RowBox[{"0.72", ",", "0.62"}], "}"}]}], "]"}]}]}], "]"}]}], ";"}], 
  "\[IndentingNewLine]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"cesfittedplotfullnew", "=", 
    RowBox[{"Plot", "[", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"(", 
         RowBox[{"1", "/", 
          RowBox[{"(", 
           RowBox[{"10", "^", "9"}], ")"}]}], ")"}], "*", 
        RowBox[{"(", 
         RowBox[{
          RowBox[{"(", 
           RowBox[{
            RowBox[{"(", 
             RowBox[{
              RowBox[{
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"production", "[", 
                  RowBox[{"[", "1", "]"}], "]"}], "/", "cestfp"}], ")"}], "^",
                "\[Rho]"}], " ", "-", " ", 
              RowBox[{
               RowBox[{"(", 
                RowBox[{"1", "-", "\[Alpha]"}], ")"}], " ", 
               RowBox[{
                RowBox[{"(", 
                 RowBox[{"x", "*", 
                  RowBox[{"(", 
                   RowBox[{"10", "^", "9"}], ")"}]}], ")"}], "^", 
                "\[Rho]"}]}]}], ")"}], "/", "\[Alpha]"}], ")"}], "^", 
          RowBox[{"(", 
           RowBox[{"1", "/", "\[Rho]"}], ")"}]}], ")"}]}], "/.", 
       "cesfitnew"}], ",", 
      RowBox[{"{", 
       RowBox[{"x", ",", 
        RowBox[{"0.75", "*", 
         RowBox[{"Min", "[", "dirtynew", "]"}]}], ",", 
        RowBox[{"Max", "[", "dirtynew", "]"}]}], "}"}], ",", 
      RowBox[{"PlotStyle", "\[Rule]", 
       RowBox[{"Directive", "[", 
        RowBox[{
         RowBox[{"GrayLevel", "[", "0.5", "]"}], ",", 
         RowBox[{"Thickness", "[", "0.01", "]"}]}], "]"}]}]}], "]"}]}], ";"}],
   "\[IndentingNewLine]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"cesfittedplotfulloldnew", "=", 
    RowBox[{"Plot", "[", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"(", 
         RowBox[{"1", "/", 
          RowBox[{"(", 
           RowBox[{"10", "^", "9"}], ")"}]}], ")"}], "*", 
        RowBox[{"(", 
         RowBox[{
          RowBox[{"(", 
           RowBox[{
            RowBox[{"(", 
             RowBox[{
              RowBox[{"(", 
               RowBox[{
                RowBox[{"(", 
                 RowBox[{
                  RowBox[{"(", 
                   RowBox[{
                    RowBox[{"production", "[", 
                    RowBox[{"[", "1", "]"}], "]"}], "/", "cestfpnew"}], ")"}],
                   "^", "\[Rho]"}], ")"}], "-", 
                RowBox[{"(", 
                 RowBox[{
                  RowBox[{"(", 
                   RowBox[{"1", "-", "\[Alpha]"}], ")"}], " ", 
                  RowBox[{
                   RowBox[{"(", 
                    RowBox[{
                    RowBox[{"(", 
                    RowBox[{
                    RowBox[{"(", 
                    RowBox[{"10", "^", "9"}], ")"}], "*", "x"}], ")"}], "/", 
                    "dn"}], ")"}], "^", "\[Rho]"}]}], ")"}]}], ")"}], "/", 
              "\[Alpha]"}], ")"}], "^", 
            RowBox[{"(", 
             RowBox[{"1", "/", "\[Rho]"}], ")"}]}], ")"}], "*", "cn"}], 
         ")"}]}], "/.", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"\[Alpha]", "\[Rule]", "newalpha"}], ",", 
         RowBox[{"\[Rho]", "\[Rule]", "rhoreopt"}], ",", 
         RowBox[{"cn", "\[Rule]", "cnnew"}], ",", 
         RowBox[{"dn", "\[Rule]", "dnnew"}]}], "}"}]}], ",", 
      RowBox[{"{", 
       RowBox[{"x", ",", 
        RowBox[{"Min", "[", "dirtynew", "]"}], ",", 
        RowBox[{"Max", "[", "dirtynew", "]"}]}], "}"}], ",", 
      RowBox[{"PlotStyle", "\[Rule]", 
       RowBox[{"Directive", "[", 
        RowBox[{
         RowBox[{"GrayLevel", "[", "0.85", "]"}], ",", 
         RowBox[{"Thickness", "[", "0.01", "]"}], ",", "Dashed"}], "]"}]}]}], 
     "]"}]}], ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"cesfullplot", "=", 
   RowBox[{"Show", "[", 
    RowBox[{
    "originaldataplot", ",", "cesfittedplotfull", ",", "cesfittedplotfullnew",
      ",", "cesfittedplotfulloldnew"}], "]"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{"cesfullplotlab", "=", 
  RowBox[{"Labeled", "[", 
   RowBox[{"cesfullplot", ",", 
    RowBox[{"MaTeX", "@", 
     RowBox[{"{", 
      RowBox[{
      "\"\<\\\\textrm{dirty inputs}~(D_{\\\\iota})~\\\\textrm{in bn \\\\euro}\
\>\"", ",", 
       "\"\<\\\\textrm{clean inputs}~(C_{\\\\iota})~\\\\textrm{in bn \
\\\\euro}\>\""}], "}"}]}], ",", 
    RowBox[{"{", 
     RowBox[{"Bottom", ",", "Left"}], "}"}], ",", 
    RowBox[{"Spacings", "\[Rule]", 
     RowBox[{"{", 
      RowBox[{"0", ",", "0", ",", "0"}], "}"}]}], ",", 
    RowBox[{"RotateLabel", "\[Rule]", "True"}]}], "]"}]}]}], "Input",
 CellChangeTimes->{{3.8003588332498937`*^9, 3.800358873585201*^9}, {
   3.800358922024971*^9, 3.800359053182473*^9}, {3.800359092127701*^9, 
   3.800359128752795*^9}, 3.8003591597955713`*^9, {3.800359219521987*^9, 
   3.800359248966671*^9}, {3.800359284040677*^9, 3.800359287009847*^9}, {
   3.8003595264935446`*^9, 3.800359858503535*^9}, {3.800360076809021*^9, 
   3.8003600896217537`*^9}, {3.8003601267958803`*^9, 
   3.8003601911505613`*^9}, {3.80036028501693*^9, 3.800360286782031*^9}, {
   3.8003603312935767`*^9, 3.800360338940014*^9}, {3.8003604020146217`*^9, 
   3.800360417454505*^9}, {3.800360550152095*^9, 3.8003605551103783`*^9}, {
   3.80036060181205*^9, 3.8003606873479424`*^9}, {3.8003607413280296`*^9, 
   3.800360755707852*^9}, {3.800360952784124*^9, 3.8003609535601683`*^9}, {
   3.8003609947505245`*^9, 3.800361035006827*^9}, 3.8003610700598316`*^9, {
   3.800361101233615*^9, 3.800361101792647*^9}, {3.800361148160299*^9, 
   3.80036115289857*^9}, {3.8003611983861713`*^9, 3.8003613177029963`*^9}, {
   3.800361388444042*^9, 3.80036139382835*^9}, {3.800361846908265*^9, 
   3.8003618679004655`*^9}, {3.8003620059963646`*^9, 3.800362018528081*^9}, {
   3.80036209492045*^9, 3.800362115969654*^9}, 3.8003621590111165`*^9, {
   3.8003621998694534`*^9, 3.8003622173554535`*^9}, {3.8003622890695553`*^9, 
   3.800362293052783*^9}, {3.800362326309685*^9, 3.8003623852290554`*^9}, {
   3.800362421289118*^9, 3.8003624308156624`*^9}, {3.80036260368355*^9, 
   3.8003627295667505`*^9}, {3.800362862984381*^9, 3.8003630562114334`*^9}, {
   3.8003630923515005`*^9, 3.8003631352119517`*^9}, {3.8003631687078676`*^9, 
   3.8003631820646315`*^9}, {3.800363212180354*^9, 3.8003633450599546`*^9}, {
   3.800363393321715*^9, 3.800363411746769*^9}, {3.80036346842001*^9, 
   3.800363503187999*^9}, {3.800363559746234*^9, 3.800363684728382*^9}, {
   3.800363815998891*^9, 3.800363863667617*^9}, {3.8003638993566585`*^9, 
   3.800363933535613*^9}, {3.8003639652704287`*^9, 3.8003641162240624`*^9}, {
   3.800893529109853*^9, 3.8008935355262194`*^9}, {3.8009469267674503`*^9, 
   3.8009469290255795`*^9}, {3.802089150356121*^9, 
   3.8020891585145884`*^9}},ExpressionUUID->"b7ed44e9-d0e5-4359-acc7-\
78559b3c1e74"],

Cell[BoxData[{
 RowBox[{
  RowBox[{"cescleanpred", "=", 
   RowBox[{"cescleanpred", "=", 
    RowBox[{"Table", "[", 
     RowBox[{
      RowBox[{"Evaluate", "[", 
       RowBox[{
        RowBox[{
         RowBox[{"(", 
          RowBox[{"1", "/", 
           RowBox[{"(", 
            RowBox[{"10", "^", "9"}], ")"}]}], ")"}], "*", 
         RowBox[{"(", 
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{"(", 
              RowBox[{
               RowBox[{"(", 
                RowBox[{
                 RowBox[{"(", 
                  RowBox[{
                   RowBox[{"(", 
                    RowBox[{
                    RowBox[{"production", "[", 
                    RowBox[{"[", "1", "]"}], "]"}], "/", "cestfpnew"}], ")"}],
                    "^", "\[Rho]"}], ")"}], "-", 
                 RowBox[{"(", 
                  RowBox[{
                   RowBox[{"(", 
                    RowBox[{"1", "-", "\[Alpha]"}], ")"}], " ", 
                   RowBox[{
                    RowBox[{"(", 
                    RowBox[{
                    RowBox[{"(", 
                    RowBox[{
                    RowBox[{"(", 
                    RowBox[{"10", "^", "9"}], ")"}], "*", "x"}], ")"}], "/", 
                    "dn"}], ")"}], "^", "\[Rho]"}]}], ")"}]}], ")"}], "/", 
               "\[Alpha]"}], ")"}], "^", 
             RowBox[{"(", 
              RowBox[{"1", "/", "\[Rho]"}], ")"}]}], ")"}], "*", "cn"}], 
          ")"}]}], "/.", 
        RowBox[{"{", 
         RowBox[{
          RowBox[{"\[Alpha]", "\[Rule]", "newalpha"}], ",", 
          RowBox[{"\[Rho]", "\[Rule]", "rhoreopt"}], ",", 
          RowBox[{"cn", "\[Rule]", "cnnew"}], ",", 
          RowBox[{"dn", "\[Rule]", "dnnew"}]}], "}"}]}], "]"}], ",", 
      RowBox[{"{", 
       RowBox[{"x", ",", "dirtynew"}], "}"}]}], "]"}]}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"cescleandiff", "=", 
   RowBox[{"cescleanpred", "-", "cleannew"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"cesMAE", "=", 
   RowBox[{
    RowBox[{"Total", "[", 
     RowBox[{"(", 
      RowBox[{"Abs", "[", "cescleandiff", "]"}], ")"}], "]"}], "/", 
    RowBox[{"Length", "[", "clean", "]"}]}]}], 
  "\[IndentingNewLine]"}], "\[IndentingNewLine]", 
 RowBox[{"MatrixForm", "[", 
  RowBox[{"{", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{
     "\"\<\>\"", ",", "\"\<baseline\>\"", ",", "\"\<  \>\"", ",", 
      "\"\<re-normalized\>\"", ",", "\"\<  \>\"", ",", 
      "\"\<to be resembled\>\"", ",", "\"\<  \>\"", ",", 
      "\"\<re-fitted\>\""}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"\"\<\[Alpha]\>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{"alphaold", ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}], ",", "\"\<  \>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{"newalpha", ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}], ",", "\"\<  \>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{
        RowBox[{
         RowBox[{"cesfitnew", "[", 
          RowBox[{"[", "1", "]"}], "]"}], "[", 
         RowBox[{"[", "2", "]"}], "]"}], ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}], ",", "\"\<  \>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{"newalpha", ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}]}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"\"\<A\>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{"cestfpold", ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}], ",", "\"\<  \>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{"cestfpnew", ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}], ",", "\"\<  \>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{
        RowBox[{
         RowBox[{"cesfitnew", "[", 
          RowBox[{"[", "3", "]"}], "]"}], "[", 
         RowBox[{"[", "2", "]"}], "]"}], ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}], ",", "\"\<  \>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{"cestfpnew", ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}]}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"\"\<\[Rho]\>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{
        RowBox[{"1", "/", 
         RowBox[{"(", 
          RowBox[{"1", "-", "rhoold"}], ")"}]}], ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}], ",", "\"\<  \>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{
        RowBox[{"1", "/", 
         RowBox[{"(", 
          RowBox[{"1", "-", "rhoold"}], ")"}]}], ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}], ",", "\"\<  \>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{
        RowBox[{"1", "/", 
         RowBox[{"(", 
          RowBox[{"1", "-", 
           RowBox[{
            RowBox[{"cesfitnew", "[", 
             RowBox[{"[", "2", "]"}], "]"}], "[", 
            RowBox[{"[", "2", "]"}], "]"}]}], ")"}]}], ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}], ",", "\"\<  \>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{
        RowBox[{"1", "/", 
         RowBox[{"(", 
          RowBox[{"1", "-", "rhoreopt"}], ")"}]}], ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}]}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{"\"\<MSE\>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{"MSEold", ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}], ",", "\"\<  \>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{"MSErenorm", ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}], ",", "\"\<  \>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{"MSEtobefitted", ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}], ",", "\"\<  \>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{"MSEnew", ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}]}], "}"}], ",", 
    RowBox[{"{", 
     RowBox[{
     "\"\<MAE\>\"", ",", "\"\<see 'plots.nb'\>\"", ",", "\"\<  \>\"", ",", 
      "\"\<see 'plots.nb'\>\"", ",", "\"\<  \>\"", ",", 
      "\"\<see 'plots.nb'\>\"", ",", "\"\<  \>\"", ",", 
      RowBox[{"NumberForm", "[", 
       RowBox[{"cesMAE", ",", 
        RowBox[{"{", 
         RowBox[{"10", ",", "5"}], "}"}]}], "]"}]}], "}"}]}], "}"}], 
  "]"}]}], "Input",
 CellChangeTimes->{{3.8033782439188566`*^9, 3.8033783981120787`*^9}, {
   3.8033784384371357`*^9, 3.8033784967942176`*^9}, {3.8033785403452787`*^9, 
   3.80337861203938*^9}, {3.8033787161425266`*^9, 3.8033788881867685`*^9}, {
   3.8033790520650043`*^9, 3.803379053581006*^9}, {3.803379097560068*^9, 
   3.8033790986550694`*^9}, {3.8033793679314547`*^9, 
   3.8033793968904953`*^9}, {3.8033795731207523`*^9, 
   3.8033796657888875`*^9}, {3.8033797208209653`*^9, 3.803379778574046*^9}, {
   3.803379818715108*^9, 3.803379885514202*^9}, {3.8033799419352865`*^9, 
   3.8033799423952875`*^9}, {3.803380124018543*^9, 3.803380124198543*^9}, {
   3.803380196907645*^9, 3.803380239328705*^9}, {3.8033802976957874`*^9, 
   3.803380300320791*^9}, 3.8033803974269323`*^9, {3.8033804456610003`*^9, 
   3.803380469884034*^9}, {3.803380518430107*^9, 3.8033805693501787`*^9}, {
   3.8033807168194013`*^9, 3.8033808172325473`*^9}, {3.803380913052685*^9, 
   3.8033809141286864`*^9}, {3.80338318105894*^9, 3.803383186233947*^9}, {
   3.8033832394860272`*^9, 
   3.8033833294311585`*^9}},ExpressionUUID->"362b65a6-c48d-472e-be19-\
b0fd11207fca"]
}, Open  ]]
},
Evaluator->"Local 4",
WindowSize->{667, 670},
WindowMargins->{{Automatic, 0}, {Automatic, 0}},
FrontEndVersion->"11.1 for Microsoft Windows (64-bit) (April 18, 2017)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[558, 20, 1268, 21, 201, "Text", "ExpressionUUID" -> \
"0f9a4e7b-4739-48d6-acc7-ac10de2846d3"],
Cell[1829, 43, 255, 5, 30, "Input", "ExpressionUUID" -> \
"9337ec9f-666f-4e0c-9b50-d9e3fbb4f3a4"],
Cell[2087, 50, 1162, 28, 164, "Input", "ExpressionUUID" -> \
"2fa4f08f-c495-42f1-9f0b-6392399f926e"],
Cell[3252, 80, 329, 10, 10, "Text", "ExpressionUUID" -> \
"da3ad750-d73c-40b5-9ed5-a2ca3e5ce6b9"],
Cell[CellGroupData[{
Cell[3606, 94, 211, 3, 70, "Section", "ExpressionUUID" -> \
"b5d0c6b6-dacb-4cb0-91f1-3d6e1731915f"],
Cell[3820, 99, 638, 12, 68, "Text", "ExpressionUUID" -> \
"aa0640f8-0669-4dca-b909-fc26633ac5de"],
Cell[4461, 113, 8573, 198, 753, "Input", "ExpressionUUID" -> \
"f248115f-2759-47e1-90d4-f25bc85b661e"],
Cell[13037, 313, 329, 10, 10, "Text", "ExpressionUUID" -> \
"a50e10ac-208b-4c82-a5d2-2055663b7c4f"]
}, Open  ]],
Cell[CellGroupData[{
Cell[13403, 328, 318, 5, 70, "Section", "ExpressionUUID" -> \
"d68f80a8-30b1-4c0f-a946-2f96968a9e14"],
Cell[13724, 335, 1284, 23, 50, "Input", "ExpressionUUID" -> \
"b13bf1d7-c53a-4922-a908-f4a1c08f25ec"],
Cell[15011, 360, 1217, 35, 69, "Input", "ExpressionUUID" -> \
"f57a3856-54b9-4be0-b25a-2fe06611af5c"],
Cell[16231, 397, 362, 7, 30, "Input", "ExpressionUUID" -> \
"9bf3c367-26f5-4c0b-a9a6-9c14fc00c4d9"],
Cell[16596, 406, 447, 9, 30, "Input", "ExpressionUUID" -> \
"6e7e4e46-de1c-4bfc-bbc1-cda0b388f42d"],
Cell[17046, 417, 1369, 36, 69, "Input", "ExpressionUUID" -> \
"00c35f79-3923-469b-b5d3-fbcc762467f2"],
Cell[18418, 455, 329, 10, 10, "Text", "ExpressionUUID" -> \
"c1f9996a-3218-4066-963d-18bcaf05a538"],
Cell[18750, 467, 1875, 40, 50, "Input", "ExpressionUUID" -> \
"2c703373-1d9a-4288-8327-9eaa55b6b9c9"],
Cell[20628, 509, 1121, 31, 50, "Input", "ExpressionUUID" -> \
"b5a9d245-4585-4949-a50f-2ac58829c9c2"],
Cell[21752, 542, 329, 10, 10, "Text", "ExpressionUUID" -> \
"3cc0991e-9b52-412e-9e20-c23576351179"]
}, Open  ]],
Cell[CellGroupData[{
Cell[22118, 557, 413, 8, 111, "Section", "ExpressionUUID" -> \
"bdef7f3d-710f-46fe-a093-bc3df86ace7c"],
Cell[22534, 567, 2558, 63, 126, "Input", "ExpressionUUID" -> \
"11bb7634-251a-4643-9b49-9c12e31d07e9"],
Cell[25095, 632, 3176, 73, 126, "Input", "ExpressionUUID" -> \
"e5531ccd-0b0b-4966-99ee-3e4df930864d"],
Cell[28274, 707, 259, 6, 30, "Input", "ExpressionUUID" -> \
"85bdd43c-fa13-4898-9349-fbad05ce991d"],
Cell[28536, 715, 329, 10, 10, "Text", "ExpressionUUID" -> \
"d18c15e7-10c4-4be8-aaef-01265b83fb16"]
}, Open  ]],
Cell[CellGroupData[{
Cell[28902, 730, 386, 6, 70, "Section", "ExpressionUUID" -> \
"2b659fd2-558a-44f4-9a3d-2513b65db51c"],
Cell[29291, 738, 1577, 39, 88, "Input", "ExpressionUUID" -> \
"ff75bb7c-e0f1-480f-b5b8-e5dcdf6512bf"],
Cell[30871, 779, 1390, 36, 88, "Input", "ExpressionUUID" -> \
"d3a54fda-cf70-40f7-a7cb-7ae8e0f9fc96"],
Cell[32264, 817, 1749, 45, 107, "Input", "ExpressionUUID" -> \
"bfc9845b-3d37-444f-b175-716c9e5f0159"],
Cell[34016, 864, 1774, 45, 107, "Input", "ExpressionUUID" -> \
"e7b786bd-1fd8-4847-ab04-a09dae5c9f70"],
Cell[35793, 911, 816, 20, 30, "Input", "ExpressionUUID" -> \
"d6c76658-8f74-4cd6-a99f-d96c5d03e82d"],
Cell[36612, 933, 422, 9, 30, "Input", "ExpressionUUID" -> \
"5cc5b3cf-c7aa-4bd6-bfb3-4b68e00578c9"],
Cell[37037, 944, 3413, 96, 183, "Input", "ExpressionUUID" -> \
"734071b0-1869-4ef2-9e71-a9b81c208668"],
Cell[40453, 1042, 329, 10, 8, "Text", "ExpressionUUID" -> \
"0bcc29a2-301e-4b42-adf8-64cde3347e59"]
}, Open  ]],
Cell[CellGroupData[{
Cell[40819, 1057, 378, 6, 70, "Section", "ExpressionUUID" -> \
"b8b9c42e-97c2-4887-96b8-d56aae72352e"],
Cell[41200, 1065, 16231, 407, 1323, "Input", "ExpressionUUID" -> \
"b7ed44e9-d0e5-4359-acc7-78559b3c1e74"],
Cell[57434, 1474, 7684, 195, 544, "Input", "ExpressionUUID" -> \
"362b65a6-c48d-472e-be19-b0fd11207fca"]
}, Open  ]]
}
]
*)

